<?php

use yii\db\Migration;

class m170222_014208_create_customer_branchaccount extends Migration
{
    public function safeUp()
    {
        $this->createTable('{{%customer_branchaccount}}', [
            'id'      => $this->primaryKey() . ' COMMENT \'自动编号\'',
            'customer_id' => $this->integer()->notNull()->defaultValue(0) . ' COMMENT \'用户id\'',
            'site_id' => $this->smallInteger(6)->notNull()->defaultValue(0) . ' COMMENT \'分店id\'',
            'scholarship_available' => $this->decimal(10,2)->defaultValue(0.00) . ' COMMENT \'可用奖学金\'',
            'scholarship_frozen' => $this->decimal(10,2)->defaultValue(0.00) . ' COMMENT \'冻结奖学金\'',
            'cash' => $this->decimal(10,2)->defaultValue(0.00) . ' COMMENT \'现金\'',
            'deposit' => $this->decimal(10,2)->defaultValue(0.00) . ' COMMENT \'保证金\'',
            'is_default' => $this->smallInteger(2)->defaultValue(0) . ' COMMENT \'默认激活的分账户（0非 1是）\'',
            'mode' => $this->smallInteger(2)->defaultValue(0) . ' COMMENT \'所属类型（1共同体 2综合体 3管弦乐）\'',
            'created_at' => $this->integer()->notNull()->defaultValue(0) . ' COMMENT \'创建时间\'',
            'updated_at' => $this->integer()->notNull()->defaultValue(0) . ' COMMENT \'更改时间\'',
        ]);
    }

    public function safeDown()
    {
        $this->dropTable('{{%customer_branchaccount}}');
    }
}
